<template>
  <div id="app">
    <template v-if="route.path.startsWith('/user')">
      <UserLayout />
    </template>
    <template v-else>
      <BasicLayout />
    </template>
  </div>
</template>

<script setup lang="ts">
import BasicLayout from "@/layouts/BasicLayout.vue";
import { useRoute, useRouter } from "vue-router";
import { useStore } from "vuex";
import { onMounted } from "vue";
import UserLayout from "@/layouts/UserLayout.vue";
// 全局初始化函数，，有全局单次调用的代码，都可以写在这里
const doInit = () => {
  console.log();
};

onMounted(() => {
  doInit();
});

const route = useRoute();

// const router = useRouter();
// const store = useStore();
// // 在到达之前
// router.beforeEach((to, from, next) => {
//   console.log(to);
//   if (to.meta.access === "canAdmin") {
//     if (store.state.user.loginUser.role !== "admin") {
//       next("/noAuth");
//       return;
//     }
//   }
//
//   next();
// });
</script>
